package fr.lip6.meta.ple.constraintsextraction.constraint;

import fr.lip6.meta.ple.featureIdentification.Feature;

public class Constraint {

 private Expression left;
 private Expression right;
 
 
 public Constraint(Expression l, Expression r){
	 
	 left=l;
	 right =r;
 }

public Constraint(Feature f1, Feature f2){
	 left=new Leaf(f1);
	 right =new Leaf(f2);
 }

public Constraint(Expression e, Feature f2){
	 left=e;
	 right =new Leaf(f2);
}

public Constraint(Feature f1, Expression e){
	 left=new Leaf(f1);
	 right =e;
}



public Expression getLeft() {
	return left;
}

public Expression getRight() {
	return right;
}

@Override
public String toString() {
	return getLeft() + " ==> " + getRight();
}

public void display()
{
	System.out.println(this.toString());
}

public boolean equals(Object o){
	
if (!(o instanceof Constraint))
	return false;
else {
	Constraint c = (Constraint)o;
	return this.toString().equals(c.toString());
}
}

}
